<script type="text/javascript">
$(function () {
	var url = '${contextPath}script/el/classes.js';
	$.ajax({url:url, dataType:'script', cache:true,
		success: function(){
			setStudentsCodes_classes();
		}
	});
	$('#editClassesForm').find("input:checkbox, input:radio").not('input.ibtn').uniform();
});
</script>
<style>
.my-filter-table {
	background: linear-gradient(to bottom, #F1FAFE 0%, #D9EDF7 100%) repeat scroll 0 0 rgba(0, 0, 0, 0);
	border: 1px solid #9BE2F0;
	display: inline-block;
	margin-bottom: 5px;
	margin-left: 5px;
	text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}
.my-filter-table a {
	color: #3A87AD;
    display: inline-block;
    margin: 0 4px;
}

.my-filter-table button {
	background: none repeat scroll 0 0 rgba(0, 0, 0, 0);
    border: 0 none;
    cursor: pointer;
    padding: 0;
    color: #000000;
    float: right;
    font-size: 20px;
    font-weight: bold;
    line-height: 20px;
    opacity: 0.4;
    text-shadow: 0 1px 0 #FFFFFF;
}

.add-tag-input {
	width:80px;
}
</style>
<#import "/freemarker/modeltype.ftl" as mt>
<#import "/freemarker/modeltype_entity.ftl" as mte>
<#import "/freemarker/datetime.ftl" as dt>
<div class="bg-light lter b-b wrapper-md">
	<h1 class="m-n font-thin h3">编辑班级信息</h1>
</div>
<div class="widget" >
	<div class="widget-content">
		<form id="editClassesForm">
			<div class="span6">
				<table style="width:300px;"  class="table table-bordered">
					<tr>
						<td>班级名称</td>
						<td>
							<input type="text" name="name" id="name" value="${(info.name)!''}" class="form-control" style="width: 120px;" />
							<input type="hidden" id="codes4" value=""/>
							<input type="hidden" name="code" value="${(info.code)!''}"/>
						</td>
					</tr>
					<tr>
						<td>报名方式</td>
						<td><@mte.Signhow id="howClass" nullstr='请选择' name="how" value=((info.how)!'')  classname="form-control" wid="120px" onchange="onchangeHowClasses_classes();"/></td>
					</tr>
					<tr>
						<td>报名人数上限</td>
						<td><input type="text" name="num" id="num" value="${(info.num)!''}" style="width: 80px;" onclick="javascript: checkhow_classes();return false;"/></td>
					</tr>
					<tr>
						<td>报名时间</td>
						<td>
							<input id="start" type="text" style="width:80px;" name="startSignTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});" value="${(info.startSignTime)!''}"/>
								至  
							<input id="end" type="text" style="width:80px;" name="endSignTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});" value="${(info.endSignTime)!''}"/>
						</td>
					</tr>
					<tr>
						<td>开班时间</td>
						<td>
							<input id="start" type="text" style="width:80px;" name="beginTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});" value="${(info.beginTime)!''}"/>
								至  
							<input id="end" type="text" style="width:80px;" name="finishTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});" value="${(info.finishTime)!''}"/>
						</td>
					</tr>
					<tr>
						<td>课程选择</td>
						<td><a class="btn m-b-xs w-xs btn-dark" onclick="javascript:addNewCourse_classes(); return false;" title="添加课程" >
							<i class="fa fa-plus"></i>&nbsp;&nbsp;添加</a>
						</td>
					</tr>
				</table>
				<div align="center">
					<button class="btn btn-xs btn-info" onclick="javascript: checkClassesInfo(); return false;" title="保存" >
						<i class="icon-save"></i>&nbsp;&nbsp;保存
					</button>&nbsp;&nbsp;&nbsp;
					<button class="btn btn-xs btn-primary" onclick="javascript: sys_load_handle('classes'); return false;" title="取消">
						取消
					</button>
				</div>
			</div>
			<div class="span6" style="overflow:scroll;height:300px;width:300px;float: rigth; <#if info?? && info.how == 3 ><#else>display: none;</#if>" id="studentsDiv">
				<div class="panel-heading font-bold">自选学生信息<a href="javascript:;" onclick="javascript: chooseUserClass_classes();return false;"><span style="color:blue;">[添加新学生]</span></a></div>
					<div class="form-group">
						<label class="col-sm-2 control-label"></label>
						<div class="col-sm-15">
						<div class="myUl" id="student">
							<#assign j = 0/>
							<#if info?? && info.ucrList??>
							<#list info.ucrList as ucr>
								<div class="my-filter-table rep">
									<input  class="form-control ucName"  type="hidden" style="width:60px;">${(ucr.ucn)!''}
									<input class="ucCode" type="hidden" name="ucrList[${j}].uc" value="${(ucr.uc)!''}"/>
									<a href="javascript:;" onclick="javascrit:deleteChoiseClass_classes($(this));return false;"></a>
									<button type="button" class="del-tag" data-dismiss="alert">&times;</button>
								</div>
							<#assign j = j + 1 />
							</#list>
							</#if>
						</div>
						<input type="hidden" id="stIndex" value="${j}"/>
					</div>
				</div>
			</div>
			
			<div class="panel panel-default" style="width:60%; clear:both; <#if info?? && info.ccrList??><#else>display: none;</#if>" id="courseTableDiv">
				<div class="col-sm-15">
					<table class="table table-bordered">
					<thead>
						<th>课程名称</th>
						<th>讲师</th>
						<th>模板</th>
						<th>选题</th>
						<th>考时/分</th>
						<th>提醒时间</th>
						<th>考次</th>
						<th>总分/合格分</th>
						<th>查看试卷</th>
						<th>操作</th>
					</thead>
					<tbody id="courseTbody">
						<#assign i = 0 />
						<#if info?? && info.ccrList??>
						<#list info.ccrList as ccr>
						<tr>
							<td>
								<@mte.Course  nullstr='请选择' name="" value=((ccr.cc)) classname="form-control cc" wid="80px;" disable=true onchange="" id="cc_${i}"/>
								<input type="hidden"  value="${ccr.clc}" name="ccrList[${i}].clc" />
							</td>
							<td>
								<@mte.CcTc  nullstr='请选择' name="ccrList[${i}].tc" value=((ccr.tc)) cc=(ccr.cc) classname="form-control cc" wid="80px;" onchange="" id="tc_${i}" oc=(cu_organCode)/>
							</td>
							<td>
								<input type="hidden" value="${(ccr.cc)!''}" name="ccrList[${i}].cc" class="ccCode"/>
								<input type="hidden" value="${(ccr.ttc)!''}" name="crList[${i}].ttc"/>
								<@mte.Templates  nullstr='自选题'  oc=((cu_organCode)!'')  value=((ccr.ttc)!'') classname="form-control ttc" wid="90px" disable=true />
							</td>
							<td>
								<button class="btn btn-xs btn-dark" onclick="javascript:choiseTopicAll_classes($(this)); return false;" title="添加题目" i="${i}"><i class="icon-plus"></i>
							</td>
							<td><input type="text" name="ccrList[${i}].examTime" value="${(ccr.examTime)!''}" style="width:20px;"/></td>
							<td><input type="text" name="ccrList[${i}].time" value="${(ccr.time)!''}" style="width:20px;"/></td>
							<td><input type="text" value="${(ccr.num)!''}" name="ccrList[${i}].num" class="form-control examNum"  style="width:20px;"/></td>
							<td><font class="zf">${ccr.total}</font>/<input type="text" value="${(ccr.qualifiedSocre)!''}" name="ccrList[${i}].qualifiedSocre" class="form-control qualifiedSocre"  style="width:30px;"/></td>
							<td>
								<select name="ccrList[${i}].type" class="type" style="width: 80px;">
									<#if ccr.type?? && ccr.type == 1><option value="1">查看自选</option><option value="2">查看所有</option>
									<#elseif ccr.type?? && ccr.type == 2><option value="2">查看所有</option><option value="1">查看自选</option>
									<#else>
										<option value="1">查看自选</option>
										<option value="2">查看所有</option>
									</#if>
								</select>
							</td>
							<td>
								<button class="btn btn-xs btn-danger" onclick="javascript:deleteCourseClass_classes($(this)); return false;" title="删除"><i class="icon-remove"></i>
							</td>
						</tr>
						<#assign i = i + 1/>
						</#list>
						</#if>
					</tbody>
				</table>
				<input type="hidden" id="index" value="${i}"/>
				</div>
			</div>
			<table id="topicEd" style="display: none;">
				<#assign k = 0 />
				<#if info?? && info.cctrList??>
				<#list info.cctrList as cctr>
				<tr class="cc_${cctr.cc}">
					<td><input type="hidden" name="cctrList[${k}].tic" value="${cctr.tic!''}"/></td>
					<td><input type="hidden" name="cctrList[${k}].cc" value="${cctr.cc!''}"/></td>
					<td><input type="hidden" name="cctrList[${k}].tc" value="${cctr.tc!''}"/></td>
					<td><input type="hidden" name="cctrList[${k}].points" value="${cctr.points!''}"/></td>
					<!-- <td><input type="hidden" name="cctrList[${k}].code" value="${cctr.code!''}"/></td> -->
					<td><input type="hidden" name="cctrList[${k}].clc" value="${cctr.clc!''}"/></td>
					<td><input type="hidden" value="${cctr.type!''}" /></td>
				</tr>
				<#assign k = k + 1 />
				</#list>
				</#if>
				<input id="topicIndex" value="${k}" type="hidden"/>
			</table>
		</form>
	</div>
</div>

<table id="courseTable" style="display: none;">
	<tr>
		<td><@mte.Course  nullstr='请选择'  oc=((cu_organCode)!'') classname="form-control cc" wid="80px;" onchange="onchangeCourse_classes($(this),${i});return false;"/></td>
		<td><select style="width: 80px;" class="tc">
				<option value="">请选择</option>
			</select>
		</td>
		<td><@mte.Templates  nullstr='自选题'  oc=((cu_organCode)!'') onchange="sore_classes($(this));" classname="form-control ttc" wid="90px;"/></td>
		<td>
			 <button class="btn btn-xs btn-dark" onclick="javascript:choiseTopicAll_classes($(this)); return false;" title="添加题目" ><i class="icon-plus"></i>
		</td>
		<td><input type="text" class="form-control" style="width:20px;"/></td>
		<td><input type="text" class="form-control" style="width:20px;"/></td>
		<td><input type="text" class="form-control examNum" style="width:20px;"/></td>
		<td><font class="zf"></font>/<input type="text" class="form-control qualifiedSocre" style="width:30px;"/></td>
		<td><select style="width: 80px;" class="type">
				<option value="1">查看自选</option>
				<option value="2">查看所有</option>
			</select>
		</td>
		<td>
			<button class="btn btn-xs btn-danger" onclick="javascript:deleteCourseClass_classes($(this)); return false;" title="删除"><i class="icon-remove"></i>
		</td>
	</tr>
</table>

